﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wsitech.BLL;
using Wsitech.Model;

public partial class Backend_Admin_ChangePassword : BackendPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (base.IsVerified && base.VerifiedUser.UserPassword != AdminUserBLL.Instance.GetEncriptPassword(txtOldPsw.Text.Trim()))
        {
            base.Alert("旧密码不正确！");
            return;
        }
        if (txtNewPsw.Text.Trim() == "")
        {
            base.Alert("新密码不能为空");
            return;
        }
        else if (txtNewPsw.Text.Trim() != txtNewPswAgain.Text.Trim())
        {
            base.Alert("两次密码输入不一致!");
            return;
        }

        AdminUser user = base.VerifiedUser;

        user.UserPassword = AdminUserBLL.Instance.GetEncriptPassword(txtNewPsw.Text.Trim());

        AdminUserBLL.Instance.Update(user);

        base.AlertGo("密码修改成功，请重新登录！", base.BACKEND_LOGOUT);
    }
}